import { request } from '../utils/request'

async function createFenceByTrackNo(taskType, stationNo, trackId, fenceType, trackName, trackType) {
  var data2 = {
    fence_type: fenceType,
    taskType: taskType,
    workArea: {
      places: [
        {
          id: trackId,
          name: trackName,
          type: trackType,
          stationNo: stationNo
        }
      ],
      areaKM: {
        start: {
          kilo: '',
          meter: ''
        },
        end: {
          kilo: '',
          meter: ''
        },
        direction: ''
      }
    }
  }
  const { data } = await request.post('/electric-fence/fenceGenerate', data2)
  return data
}

async function deleteFenceByIds(fenceIds) {
  const { data } = await request.delete('/electric-fence/', { params: { fence_id: `[${fenceIds.toString()}]` } })
  return data
}

export { createFenceByTrackNo, deleteFenceByIds }
